package com.yuexin.project.statistic.everyday.controller;


import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import com.yuexin.common.utils.poi.ExcelUtil;
import com.yuexin.common.utils.security.ShiroUtils;
import com.yuexin.framework.web.controller.BaseController;
import com.yuexin.framework.web.domain.AjaxResult;
import com.yuexin.framework.web.page.TableDataInfo;
import com.yuexin.project.statistic.everyday.domain.Everyday;
import com.yuexin.project.statistic.everyday.service.IEverydayService;

/**
 * 每日统计 信息操作处理
 * 
 * @author yuexin
 * @date 2018-10-17
 */
@Controller
@RequestMapping("/statistic/everyday")
public class EverydayController extends BaseController
{
    private String prefix = "statistic/everyday";
	
	@Autowired
	private IEverydayService everydayService;
	
	@RequiresPermissions("statistic:everyday:view")
	@GetMapping()
	public String everyday()
	{
	    return prefix + "/everyday";
	}


	
	/**
	 * 查询人员报餐统计列表
	 */
	@RequiresPermissions("statistic:everyday:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Everyday everyday)
	{
		startPage();
		everyday.setCompanyId(ShiroUtils.getCompanyId());
        List<Everyday> list = everydayService.selectEverydayCountList(everyday);
		return getDataTable(list);
	}
	
	/**
	 * 导出 exportMealCount
	 */
    @RequiresPermissions("statistic:everyday:export")
    @PostMapping("/exportMealCount")
    @ResponseBody
    public AjaxResult export(Everyday everyday)
    {
		everyday.setCompanyId(ShiroUtils.getCompanyId());
        List<Everyday> list = everydayService.selectEverydayCountList(everyday);
        ExcelUtil<Everyday> util = new ExcelUtil<Everyday>(Everyday.class);
        return util.exportExcel(list, "每日统计");
    }
}
